﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjTemp.Common.Utils
{
    public class TypeUtil
    {
        public static bool IsInstanceOfGenericType(Type genericType, object instance)
        {
            Type type = instance.GetType();
            while (type != null)
            {
                if (type.IsGenericType &&
                    type.GetGenericTypeDefinition() == genericType)
                {
                    return true;
                }
                type = type.BaseType;
            }
            return false;
        }
    }
}
